package com.wiscamp.ninechapters.problems.domain.models.problems.questions;

import com.wiscamp.ninechapters.problems.domain.models.problems.answers.Answer;
import com.wiscamp.ninechapters.problems.domain.models.problems.answers.MultipleOptionAnswer;
import lombok.Data;
import lombok.EqualsAndHashCode;

import java.util.ArrayList;
import java.util.Collection;

/**
 * 多项选择问题
 * 多项选择题型-四选项
 * 多项选择题型-五选项
 * 多项选择题型-六选项
 * 多项选择题型-七选项
 */
@Data
@EqualsAndHashCode(callSuper = true)
public class MultipleSelectionQuestion extends Question {
    public MultipleSelectionQuestion() {
        super();
        hasOptions = true;
        hasMultipleAnswers = false;
    }

    /**
     * 选项列表
     */
    private Collection<Option> options;

    /**
     * 问题答案列表
     */
    private MultipleOptionAnswer answer;

    @Override
    public void setCurrentAnswer(Answer answer) {
        this.answer = (MultipleOptionAnswer) answer;
    }

    @Override
    public Answer getCurrentAnswer() {
        return this.answer;
    }

    @Override
    public void setCurrentOptions(Collection<Option> options) {
        this.options = options;
    }

    @Override
    public Collection<Option> getCurrentOptions() {
        return options;
    }

    @Override
    public Collection<Answer> getCurrentAnswers() {
        var answers = new ArrayList<Answer>();
        answers.add(this.answer);
        return answers;
    }
}
